var util = require('../util/util'),
	common = require('../config/common');

var data = require('../data/game');

var F = {
	renderConfig : function(){
		var config = {
			currentPageCss : [
				'/game/css/nav.css',
				'/game/css/index.css'
			],
			
			title : 'Game'
		};


		return config;
	}
};

exports.index = function(req, res){
	res.render('game/index', util.merge(common, F.renderConfig()));
};

exports.game = function(req, res){
	var id = req.params.game;

	var d = {};
	for(var i=0,len=data.length; i<len; i++){
		if(data[i].id == id){
			d = data[i];
			break;
		}
	}

	res.render('game/play', {
		game : d,
		currentPageCss : [
			'/KG/lib/Normalize/normalize.css',
			'/game/css/'+id+'.css'
		]
	});
};